-- immunity
-- Created by zhuangsl Nov/28/2016
-- 天空战附加属性：天空战概率免疫异常状态
-- ([732:200])代表20%概率免疫中毒（prop_id = 732）
-- ([all:300])代表30%概率免疫所有异常状态

return {
    -- 空属性
    getEmptyProp = function()
        return {};
    end,

    -- 合并属性
    mergeSkyProp = function(data, addon)
        local result = {};

        if not data then
            result = table.copy(addon);
        else
            result = table.copy(data);

            for style, value in pairs(addon) do
                result[style] = value + (result[style] or 0);
            end
        end

        return result;
    end,

    getDesc = function(desc, data)
        local desc = "";
        local keys = table.keys(data);
        local value;

        -- 目前只需处理一条
        for _, key in ipairs(keys) do
            if key == "all" then
                desc = getLocStr("shipskill_immunity_all");
                desc = string.gsub(desc, "{rate}", math.modf(data[key] / 10), 1);
                break;
            end
        end

        return desc;
    end,
};